<!--
 * @Author: your name
 * @Date: 2023-02-27 10:57:03
 * @LastEditTime: 2023-12-20 11:35:15
 * @LastEditors: DESKTOP-4QFD9PO
 * @Description: In User Settings Edit
 * @FilePath: \ClothMes\src\views\FirstInspectionRecordList\FirstInspectionRecordListDemo.vue
-->
<template>
  <pageTabelLayout>
    <template #pageHeader>
      <div class="search-form divClass" v-if="headerShow">
        <div>
          <a-form size="small" :model="pageData" layout="inline">
            <a-form-item label="调机单号">
              <a-input
                allow-clear
                :style="{ width: '180px' }"
                class="bacClass"
                placeholder=""
                v-model="pageData.adjustmentCode"
                @press-enter="huiche"
              />
            </a-form-item>
            <a-form-item label="织布单号">
              <a-input
                allow-clear
                :style="{ width: '180px' }"
                class="bacClass"
                placeholder=""
                v-model="pageData.planOrderCode"
                @press-enter="huiche"
              />
            </a-form-item>
            <a-form-item label="生产单号">
              <a-input
                allow-clear
                :style="{ width: '180px' }"
                class="bacClass"
                placeholder=""
                v-model="pageData.weavCode"
                @press-enter="huiche"
              />
            </a-form-item>
            <a-form-item label="机台号">
              <a-input
                allow-clear
                :style="{ width: '180px' }"
                class="bacClass"
                placeholder=""
                v-model="pageData.machineCode"
                @press-enter="huiche"
              />
            </a-form-item>
            <a-form-item label="查布头时间">
              <a-date-picker popup-container="html" class="bacClass" v-model="pageData.dateStart" />
              至
              <a-date-picker popup-container="html" class="bacClass" v-model="pageData.dateEnd" />
            </a-form-item>
            <a-form-item label="复核结果">
              <a-select
                popup-container="html"
                style="width: 90px"
                class="bacClass"
                placeholder=""
                v-model="pageData.inspectionState"
              >
                <a-option :value="-1">全部</a-option>
                <a-option :value="0">不OK</a-option>
                <a-option :value="1">OK</a-option>
                <a-option :value="2">未检验</a-option>
              </a-select>
            </a-form-item>
          </a-form>
        </div>
        <div class="my-tool-bar">
          <Toolbar
            style="float: right"
            :items="pageData.btnList"
            @select="selectHandler"
            @dyBoufei="printPdf"
          >
          </Toolbar>
        </div>
      </div>
      <div class="my-divisders">
        <a-divider orientation="center">
          <icon-double-up
            v-if="headerShow"
            @click="headerShow = false"
            :strokeWidth="2"
            :size="18"
          />
          <icon-double-down v-else @click="headerShow = true" :strokeWidth="2" :size="18" />
        </a-divider>
      </div>
    </template>
    <template #pageTabel>
      <a-spin
        :loading="pageData.pageLoading"
        tip="加载中"
        dot
        style="height: 100%; width: 100%; z-index: 999"
      >
        <AgGridVuesCopys
          :rowHeight="33"
          :headerHeight="33"
          :suppressCopyRowsToClipboard="true"
          :suppressDragLeaveHidesColumns="true"
          rowSelection="multiple"
          @grid-ready="gridReady"
          @columnResized="onColumnResized"
          @columnMoved="onColumnMoved"
          @columnVisible="onColumnVisible"
          style="height: 100%"
          :defaultColDef="defaultColDef"
          class="ag-theme-alpine"
          :rowData="table.dataList"
          :columnDefs="tc"
          :localeText="localeText1"
        ></AgGridVuesCopys>
      </a-spin>
    </template>
    <paginationCopys
      :page-size-options="pagingList1"
      :page-size="pagination.pageSize"
      :current="pagination.page"
      :total="total"
      show-total
      show-jumper
      show-page-size
      @change="PageSize"
      @page-size-change="change1"
      style="justify-content: center"
    />
    <a-modal v-model:visible="visible" @cancel="handleCancel" draggable fullscreen>
      <template #title> 详情</template>
      <template #footer>
        <a-button @click="handleCancel"> 关闭</a-button>
      </template>
      <a-form size="small" :model="dataForm">
        <span :style="{ fontFamily: 'Microsoft Yahei', fontSize: '16px' }">工艺信息:</span>
        <a-row :gutter="16">
          <a-col :span="4">
            <a-form-item label="织布单号" label-col-flex="80px" disabled>
              <a-input
                allow-clear
                :style="{ width: '214px' }"
                class="bacClass"
                placeholder=""
                v-model="dataForm.planOrderCode"
              />
            </a-form-item>
          </a-col>
          <a-col :span="4">
            <a-form-item label="生产单号" label-col-flex="80px" disabled>
              <a-input
                allow-clear
                :style="{ width: '214px' }"
                class="bacClass"
                placeholder=""
                v-model="dataForm.weavCode"
              />
            </a-form-item>
          </a-col>
          <a-col :span="4">
            <a-form-item label="机台号" label-col-flex="80px" disabled>
              <a-input
                allow-clear
                :style="{ width: '214px' }"
                class="bacClass"
                placeholder=""
                v-model="dataForm.machineCode"
              />
            </a-form-item>
          </a-col>
          <a-col :span="4">
            <a-form-item label="客户名称" label-col-flex="80px" disabled>
              <a-input
                allow-clear
                :style="{ width: '214px' }"
                class="bacClass"
                placeholder=""
                v-model="dataForm.customName"
              />
            </a-form-item>
          </a-col>
          <a-col :span="4">
            <a-form-item label="可配色称" label-col-flex="80px" disabled>
              <a-input
                allow-clear
                :style="{ width: '214px' }"
                class="bacClass"
                placeholder=""
                v-model="dataForm.colorDescription"
              />
            </a-form-item>
          </a-col>
          <a-col :span="4">
            <a-form-item label="坯布编号" label-col-flex="80px" disabled>
              <a-input
                allow-clear
                :style="{ width: '214px' }"
                class="bacClass"
                placeholder=""
                v-model="dataForm.greyCode"
              />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="16">
          <a-col :span="4">
            <a-form-item label="坯布名称" label-col-flex="80px" disabled>
              <a-input
                allow-clear
                :style="{ width: '214px' }"
                class="bacClass"
                placeholder=""
                v-model="dataForm.greyName"
              />
            </a-form-item>
          </a-col>
          <a-col :span="4">
            <a-form-item label="是否开幅" label-col-flex="80px" disabled>
              <a-input
                allow-clear
                :style="{ width: '214px' }"
                class="bacClass"
                placeholder=""
                v-model="dataForm.type"
              />
            </a-form-item>
          </a-col>
          <a-col :span="4">
            <a-form-item label="是否抽针" label-col-flex="80px" disabled>
              <a-input
                allow-clear
                :style="{ width: '214px' }"
                class="bacClass"
                placeholder=""
                v-model="dataForm.drawnNeedleState"
              />
            </a-form-item>
          </a-col>
          <a-col :span="4">
            <a-form-item label="针寸数" label-col-flex="80px" disabled>
              <a-input
                allow-clear
                :style="{ width: '214px' }"
                class="bacClass"
                placeholder=""
                v-model="dataForm.workDrum"
              />
            </a-form-item>
          </a-col>
          <a-col :span="4">
            <a-form-item label="成品门幅" label-col-flex="80px" disabled>
              <a-input
                allow-clear
                :style="{ width: '214px' }"
                class="bacClass"
                placeholder=""
                v-model="dataForm.width"
              />
            </a-form-item>
          </a-col>
          <a-col :span="4">
            <a-form-item label="成品克重" label-col-flex="80px" disabled>
              <a-input
                allow-clear
                :style="{ width: '214px' }"
                class="bacClass"
                placeholder=""
                v-model="dataForm.weight"
              />
            </a-form-item>
          </a-col>
          <a-col :span="4">
            <a-form-item label="调机类型" label-col-flex="80px" disabled>
              <a-input
                allow-clear
                :style="{ width: '214px' }"
                class="bacClass"
                placeholder=""
                v-model="dataForm.maintainType"
              />
            </a-form-item>
          </a-col>
        </a-row>
        <a-form-item label="工艺备注" label-col-flex="80px" disabled>
          <a-textarea
            :auto-size="{ minRows: 3, maxRows: 300 }"
            class="bacClass"
            v-model="dataForm.craftRemark"
            allow-clear
          />
        </a-form-item>
        <a-divider />
        <span :style="{ fontFamily: 'Microsoft Yahei', fontSize: '16px' }">录入信息:</span>
        <a-row :gutter="16">
          <a-col :span="4">
            <a-form-item label="织机转速" label-col-flex="80px" disabled>
              <a-input
                allow-clear
                :style="{ width: '214px' }"
                class="bacClass"
                placeholder=""
                v-model="dataForm.machineSpeed"
              />
            </a-form-item>
          </a-col>
          <a-col :span="4">
            <a-form-item label="下机门幅" label-col-flex="80px" disabled>
              <a-input
                allow-clear
                :style="{ width: '214px' }"
                class="bacClass"
                placeholder=""
                v-model="dataForm.downLarghezza"
              />
            </a-form-item>
          </a-col>
          <a-col :span="4">
            <a-form-item label="下机克重" label-col-flex="80px" disabled>
              <a-input
                allow-clear
                :style="{ width: '214px' }"
                class="bacClass"
                placeholder=""
                v-model="dataForm.downWeight"
              />
            </a-form-item>
          </a-col>
          <a-col :span="4">
            <a-form-item label="是否染色" label-col-flex="80px" disabled>
              <a-select
                popup-container="html"
                allow-clear
                class="bacClass"
                v-model="dataForm.dyeState"
              >
                <a-option :value="0">否</a-option>
                <a-option :value="1">是</a-option>
              </a-select>
            </a-form-item>
          </a-col>
          <a-col :span="4">
            <a-form-item label="是否洗水" label-col-flex="80px" disabled>
              <a-select
                popup-container="html"
                allow-clear
                class="bacClass"
                v-model="dataForm.washingState"
              >
                <a-option :value="0">否</a-option>
                <a-option :value="1">是</a-option>
              </a-select>
            </a-form-item>
          </a-col>
          <a-col :span="4">
            <a-form-item label="洗后门幅" label-col-flex="80px" disabled>
              <a-input
                allow-clear
                :style="{ width: '214px' }"
                class="bacClass"
                placeholder=""
                v-model="dataForm.washingedLarghezza"
              />
            </a-form-item>
          </a-col>
        </a-row>

        <a-row :gutter="16">
          <a-col :span="4">
            <a-form-item label="排针三角" label-col-flex="80px" disabled>
              <!-- <a-input allow-clear :style="{ width: '214px' }" class="bacClass" placeholder=""
                v-model="dataForm.triangularState" /> -->
              <a-select
                popup-container="html"
                allow-clear
                class="bacClass"
                v-model="dataForm.triangularState"
              >
                <a-option :value="0">否</a-option>
                <a-option :value="1">是</a-option>
              </a-select>
            </a-form-item>
          </a-col>
          <a-col :span="4">
            <a-form-item label="洗后克重" label-col-flex="80px" disabled>
              <a-input
                allow-clear
                :style="{ width: '214px' }"
                class="bacClass"
                placeholder=""
                v-model="dataForm.washingedWeight"
              />
            </a-form-item>
          </a-col>
          <a-col :span="4">
            <a-form-item label="总路数" label-col-flex="80px" disabled>
              <a-input
                allow-clear
                :style="{ width: '214px' }"
                class="bacClass"
                placeholder=""
                v-model="dataForm.sumNeedleCount"
              />
            </a-form-item>
          </a-col>
          <a-col :span="4">
            <a-form-item label="织针型号" label-col-flex="80px">
              <a-input
                allow-clear
                :style="{ width: '214px' }"
                class="bacClass"
                placeholder=""
                v-model="dataForm.knitModel"
              />
            </a-form-item>
          </a-col>
          <a-col :span="4">
            <a-form-item label="备注" label-col-flex="80px">
              <a-input
                allow-clear
                :style="{ width: '214px' }"
                class="bacClass"
                placeholder=""
                v-model="dataForm.remark"
              />
            </a-form-item>
          </a-col>
        </a-row>
        <a-divider />
      </a-form>
      <a-tabs :lazy-load="true">
        <a-tab-pane title="原料信息" key="1">
          <a-table
            style="padding-bottom: 20px"
            stripe
            :bordered="{ cell: true }"
            :columns="tableColumnsCf"
            size="mini"
            :data="dataForm.list"
            :pagination="false"
          >
          <template #yarnProportion="{ record }">
              <span>{{ record.yarnProportion == '' ? '' : (Number(record.yarnProportion)).toFixed(2) + '%' }}</span>
            </template>
            <template #actualRatio="{ record }">
              <span>{{ record.actualRatio == '' ? '' : (Number(record.actualRatio)).toFixed(2) }}</span>
            </template>
            <template #yarnLength="{ record }">
              <span>{{ record.yarnLength == '' ? '' : (Number(record.yarnLength)).toFixed(2) }}</span>
            </template>
            <template #physicalLength="{ record }">
              <span>{{ record.physicalLength == '' ? '' : (Number(record.physicalLength)).toFixed(2) }}</span>
            </template>
          </a-table>
        </a-tab-pane>
        <a-tab-pane title="排针" key="2">
          <div style="width: 100%; overflow: auto">
            <div style="margin: 10px auto">
              <span>{{ dataForm.machineType == '单面机' ? '排针' : '上排' }}</span>
              <a-space>
                <input
                  disabled
                  size="mini"
                  v-for="(item, index) in zzpzdata"
                  :key="index"
                  style="width: 80px"
                  v-model="item.upBasin"
                />
              </a-space>
            </div>
            <div style="margin: 10px auto" v-if="dataForm.machineType !== '单面机'">
              <span>下排</span>
              <a-space>
                <input
                  disabled
                  size="mini"
                  v-for="(item, index) in zzpzdata"
                  :key="index"
                  style="width: 80px"
                  v-model="item.belowBasin"
                />
              </a-space>
            </div>
          </div>

          <div style="display: flex; align-items: center">
            <div style="width: 50%">
              <span>裁口排针</span>
              <a-input disabled v-model="ckpzobj.pinHeader"></a-input>
            </div>
            <div style="width: 50%">
              <span>纱线排列</span>
              <a-input disabled v-model="ckpzobj.arrangement"></a-input>
            </div>
          </div>
        </a-tab-pane>
        <a-tab-pane title="排三角" key="3">
          <div
            v-for="(item, index) in sjdata.sj as any"
            style="text-align: center; margin: 20px auto; width: 100%; overflow-x: auto"
          >
            <div
              style="
                text-align: center;
                color: #165dff;
                font-size: 16px;
                background-color: aliceblue;
                border-bottom: 0.5px solid #ccc;
              "
            >
              {{ item.type }}
            </div>

            <div class="thead" style="background-color: aliceblue">
              <div class="th" style="width: 50px">序号</div>
              <div class="th" style="width: 150px">用针</div>
              <div
                class="th"
                style="width: 40px"
                v-for="i2 in item.typeData[0].needleList"
                :key="i2.way"
              >
                {{ i2.way }}
              </div>
            </div>
            <div class="tbody" v-for="i1 in item.typeData">
              <div class="td" style="width: 50px">{{ i1.serialNumber }}</div>
              <div class="td" style="width: 150px">
                <a-input disabled v-model="i1.needleName"></a-input>
              </div>
              <div
                class="td"
                style="height: 34px; width: 40px; vertical-align: middle; border: 1px solid gray"
                v-for="i2 in i1.needleList"
              >
                <div style="width: 100%; height: 100%"
                  >{{ tags.filter((o) => o.id === i2.needle)[0]?.val }}
                </div>
              </div>
            </div>
            <div style="height: 20px"></div>
            <div style="height: 20px"></div>
            <div style="border: 1px solid #ccc"></div>
          </div>
          <div class="tbody" style="margin-top: 10px">
            <div
              style="
                text-align: center;
                color: #165dff;
                font-size: 16px;
                background-color: aliceblue;
                border-bottom: 0.5px solid #ccc;
              "
            >
              排纱
            </div>
            <div class="trow" style="background-color: aliceblue">
              <div
                style="
                  height: 30px;
                  display: inline-block;
                  width: 82px;
                  vertical-align: top;
                  box-sizing: border-box;
                "
              >
              </div>
              <div
                style="
                  height: 30px;
                  display: inline-block;
                  width: 82px;
                  vertical-align: top;
                  box-sizing: border-box;
                "
              >
              </div>
            </div>
            <div class="trow" v-for="(item, index) in psList">
              <div
                style="border: 1px solid #ccc; height: 30px; box-sizing: border-box"
                v-for="(item1, index1) in item"
              >
                <input
                  v-model="item1.val"
                  v-if="
                    !((index > 0 && (index1 == 0 || index1 == 1)) || (index == 0 && index1 === 2))
                  "
                  style="width: 80px; vertical-align: top; height: 100%; text-align: center"
                  :class="{ active: index1 == 0 || index1 == 1 }"
                />
                <div
                  v-if="(index > 0 && (index1 == 0 || index1 == 1)) || (index == 0 && index1 === 2)"
                  style="width: 80px; vertical-align: top; height: 100%; text-align: center"
                  :class="{ active: index1 == 0 || index1 == 1 }"
                  >{{ item1.val }}
                </div>
              </div>
            </div>
          </div>
        </a-tab-pane>
        <a-tab-pane title="调机标准参数" key="4">
          <a-row :gutter="16">
            <a-col :span="4">
              <div :style="{ fontFamily: 'Microsoft Yahei', fontSize: '16px' }"
                >布架宽度:&nbsp;&nbsp;{{ tjObj?.clothRackWidth }}
              </div>
            </a-col>
            <a-col :span="4">
              <div :style="{ fontFamily: 'Microsoft Yahei', fontSize: '16px' }">
                织针型号:&nbsp;&nbsp;{{ tjObj?.needleModel }}
              </div>
            </a-col>
            <a-col :span="4">
              <div :style="{ fontFamily: 'Microsoft Yahei', fontSize: '16px' }"
                >织针1段:&nbsp;&nbsp;{{ tjObj?.needleOnePerod == 1 ? '√' : '' }}
              </div>
            </a-col>
            <a-col :span="4">
              <div :style="{ fontFamily: 'Microsoft Yahei', fontSize: '16px' }"
                >织针2段:&nbsp;&nbsp;{{ tjObj?.needleTwoPerod == 1 ? '√' : '' }}
              </div>
            </a-col>
            <a-col :span="4">
              <div :style="{ fontFamily: 'Microsoft Yahei', fontSize: '16px' }"
                >织针3段:&nbsp;&nbsp;{{ tjObj?.needleThreePerod == 1 ? '√' : '' }}
              </div>
            </a-col>
            <a-col :span="4">
              <div :style="{ fontFamily: 'Microsoft Yahei', fontSize: '16px' }"
                >织针4段:&nbsp;&nbsp;{{ tjObj?.needleFourPerod == 1 ? '√' : '' }}
              </div>
            </a-col>
          </a-row>
          <a-divider />
          <a-row :gutter="16">
            <a-col :span="4">
              <div :style="{ fontFamily: 'Microsoft Yahei', fontSize: '16px' }"
                >织针需求等级:&nbsp;&nbsp;{{ tjObj?.needleGrade }}
              </div>
            </a-col>
            <a-col :span="4">
              <div :style="{ fontFamily: 'Microsoft Yahei', fontSize: '16px' }"
                >分食:&nbsp;&nbsp;{{ tjObj?.broken == 1 ? '√' : '' }}
              </div>
            </a-col>
            <a-col :span="4">
              <div :style="{ fontFamily: 'Microsoft Yahei', fontSize: '16px' }"
                >争食:&nbsp;&nbsp;{{ tjObj?.dodge == 1 ? '√' : '' }}
              </div>
            </a-col>
            <a-col :span="4">
              <div :style="{ fontFamily: 'Microsoft Yahei', fontSize: '16px' }"
                >不争不分:&nbsp;&nbsp;{{ tjObj?.allTrue == 1 ? '√' : '' }}
              </div>
            </a-col>
            <a-col :span="4">
              <div :style="{ fontFamily: 'Microsoft Yahei', fontSize: '16px' }"
                >布架张力A-D:&nbsp;&nbsp;{{ tjObj?.clothTensionAD }}
              </div>
            </a-col>
            <a-col :span="4">
              <div :style="{ fontFamily: 'Microsoft Yahei', fontSize: '16px' }"
                >布架张力1-16:&nbsp;&nbsp;{{ tjObj?.clothTensionOS }}
              </div>
            </a-col>
          </a-row>
          <a-divider />
          <a-row :gutter="16">
            <a-col :span="4">
              <div :style="{ fontFamily: 'Microsoft Yahei', fontSize: '16px' }">
                底座垫片:&nbsp;&nbsp;{{ tjObj?.baseGasket }}
              </div>
            </a-col>
            <a-col :span="4">
              <div :style="{ fontFamily: 'Microsoft Yahei', fontSize: '16px' }"
                >送纱盘-面盘:&nbsp;&nbsp;{{ tjObj?.sandTableSurfacePlate }}
              </div>
            </a-col>
            <a-col :span="4">
              <div :style="{ fontFamily: 'Microsoft Yahei', fontSize: '16px' }"
                >送纱盘-中盘:&nbsp;&nbsp;{{ tjObj?.sandTrayMiddlePlate }}
              </div>
            </a-col>
            <a-col :span="4">
              <div :style="{ fontFamily: 'Microsoft Yahei', fontSize: '16px' }"
                >送纱盘-底盘:&nbsp;&nbsp;{{ tjObj?.sandTrayMiddlePlate }}
              </div>
            </a-col>
            <a-col :span="4">
              <div :style="{ fontFamily: 'Microsoft Yahei', fontSize: '16px' }"
                >齿轮:&nbsp;&nbsp;{{ tjObj?.gear }}</div
              >
            </a-col>
            <a-col :span="4">
              <div :style="{ fontFamily: 'Microsoft Yahei', fontSize: '16px' }"
                >机速:&nbsp;&nbsp;{{ tjObj?.engineSpeed }}
              </div>
            </a-col>
          </a-row>
          <a-divider />
          <a-row :gutter="16">
            <a-col :span="4">
              <div :style="{ fontFamily: 'Microsoft Yahei', fontSize: '16px' }"
                >油速:&nbsp;&nbsp;{{ tjObj?.oilVelocity }}
              </div>
            </a-col>
            <a-col :span="4">
              <div :style="{ fontFamily: 'Microsoft Yahei', fontSize: '16px' }"
                >实开路数:&nbsp;&nbsp;{{ tjObj?.actualOpenWay }}
              </div>
            </a-col>
          </a-row>
        </a-tab-pane>
      </a-tabs>
    </a-modal>
    <a-modal
      v-model:visible="visible1"
      @ok="okClick"
      @cancel="handleClose"
      okText=" OK "
      cancelText=" 不OK "
      fullscreen
      draggable
      :ok-loading="pageData.pageLoading"
    >
      <template #title> 处理</template>
      <template #footer>
        <a-button @click="handleCancel1"> 不OK </a-button>
        <a-button @click="okClick" type="primary"> OK </a-button>
      </template>
      <a-form size="small" :model="dataForm" ref="formRef1">
        <span :style="{ fontFamily: 'Microsoft Yahei', fontSize: '16px' }">工艺信息:</span>
        <a-row :gutter="16">
          <a-col :span="4">
            <a-form-item label="织布单号" label-col-flex="80px" disabled>
              <a-input
                allow-clear
                :style="{ width: '214px' }"
                class="bacClass"
                placeholder=""
                v-model="dataForm.planOrderCode"
              />
            </a-form-item>
          </a-col>
          <a-col :span="4">
            <a-form-item label="生产单号" label-col-flex="80px" disabled>
              <a-input
                allow-clear
                :style="{ width: '214px' }"
                class="bacClass"
                placeholder=""
                v-model="dataForm.weavCode"
              />
            </a-form-item>
          </a-col>
          <a-col :span="4">
            <a-form-item label="机台号" label-col-flex="80px" disabled>
              <a-input
                allow-clear
                :style="{ width: '214px' }"
                class="bacClass"
                placeholder=""
                v-model="dataForm.machineCode"
              />
            </a-form-item>
          </a-col>
          <a-col :span="4">
            <a-form-item label="客户名称" label-col-flex="80px" disabled>
              <a-input
                allow-clear
                :style="{ width: '214px' }"
                class="bacClass"
                placeholder=""
                v-model="dataForm.customName"
              />
            </a-form-item>
          </a-col>
          <a-col :span="4">
            <a-form-item label="可配色称" label-col-flex="80px" disabled>
              <a-input
                allow-clear
                :style="{ width: '214px' }"
                class="bacClass"
                placeholder=""
                v-model="dataForm.colorDescription"
              />
            </a-form-item>
          </a-col>
          <a-col :span="4">
            <a-form-item label="坯布编号" label-col-flex="80px" disabled>
              <a-input
                allow-clear
                :style="{ width: '214px' }"
                class="bacClass"
                placeholder=""
                v-model="dataForm.greyCode"
              />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="16">
          <a-col :span="4">
            <a-form-item label="坯布名称" label-col-flex="80px" disabled>
              <a-input
                allow-clear
                :style="{ width: '214px' }"
                class="bacClass"
                placeholder=""
                v-model="dataForm.greyName"
              />
            </a-form-item>
          </a-col>
          <a-col :span="4">
            <a-form-item label="是否开幅" label-col-flex="80px" disabled>
              <a-input
                allow-clear
                :style="{ width: '214px' }"
                class="bacClass"
                placeholder=""
                v-model="dataForm.type"
              />
            </a-form-item>
          </a-col>
          <a-col :span="4">
            <a-form-item label="是否抽针" label-col-flex="80px" disabled>
              <a-input
                allow-clear
                :style="{ width: '214px' }"
                class="bacClass"
                placeholder=""
                v-model="dataForm.drawnNeedleState"
              />
            </a-form-item>
          </a-col>
          <a-col :span="4">
            <a-form-item label="针寸数" label-col-flex="80px" disabled>
              <a-input
                allow-clear
                :style="{ width: '214px' }"
                class="bacClass"
                placeholder=""
                v-model="dataForm.workDrum"
              />
            </a-form-item>
          </a-col>
          <a-col :span="4">
            <a-form-item label="成品门幅" label-col-flex="80px" disabled>
              <a-input
                allow-clear
                :style="{ width: '214px' }"
                class="bacClass"
                placeholder=""
                v-model="dataForm.width"
              />
            </a-form-item>
          </a-col>
          <a-col :span="4">
            <a-form-item label="成品克重" label-col-flex="80px" disabled>
              <a-input
                allow-clear
                :style="{ width: '214px' }"
                class="bacClass"
                placeholder=""
                v-model="dataForm.weight"
              />
            </a-form-item>
          </a-col>
          <a-col :span="4">
            <a-form-item label="调机类型" label-col-flex="80px" disabled>
              <a-input
                allow-clear
                :style="{ width: '214px' }"
                class="bacClass"
                placeholder=""
                v-model="dataForm.maintainType"
              />
            </a-form-item>
          </a-col>
        </a-row>
        <a-form-item label="工艺备注" label-col-flex="80px" disabled>
          <a-textarea
            :auto-size="{ minRows: 3, maxRows: 300 }"
            class="bacClass"
            v-model="dataForm.craftRemark"
            allow-clear
          />
        </a-form-item>
        <a-divider />
        <span :style="{ fontFamily: 'Microsoft Yahei', fontSize: '16px' }">录入信息:</span>
        <a-row :gutter="16">
          <a-col :span="4">
            <a-form-item
              label="织机转速"
              label-col-flex="80px"
              field="machineSpeed"
              :rules="[{ required: dataForm.maintainType !== '转单', message: '织机转速必填' }]"
              :validate-trigger="['change', 'blur']"
            >
              <a-input
                allow-clear
                :style="{ width: '214px' }"
                class="bacClass"
                placeholder=""
                v-model="dataForm.machineSpeed"
              />
            </a-form-item>
          </a-col>
          <a-col :span="4">
            <a-form-item
              label="下机门幅"
              label-col-flex="80px"
              field="downLarghezza"
              :rules="[{ required: dataForm.maintainType !== '转单', message: '下机门幅必填' }]"
              :validate-trigger="['change', 'blur']"
            >
              <a-input
                allow-clear
                :style="{ width: '214px' }"
                class="bacClass"
                placeholder=""
                v-model="dataForm.downLarghezza"
              />
            </a-form-item>
          </a-col>
          <a-col :span="4">
            <a-form-item
              label="下机克重"
              label-col-flex="80px"
              field="downWeight"
              :rules="[{ required: dataForm.maintainType !== '转单', message: '下机克重必填' }]"
              :validate-trigger="['change', 'blur']"
            >
              <a-input
                allow-clear
                :style="{ width: '214px' }"
                class="bacClass"
                placeholder=""
                v-model="dataForm.downWeight"
              />
            </a-form-item>
          </a-col>
          <a-col :span="4">
            <a-form-item
              label="是否染色"
              label-col-flex="80px"
              field="dyeState"
              :rules="[{ required: dataForm.maintainType !== '转单', message: '是否染色必填' }]"
              :validate-trigger="['change', 'blur']"
            >
              <a-select
                popup-container="html"
                allow-clear
                class="bacClass"
                v-model="dataForm.dyeState"
              >
                <a-option :value="0">否</a-option>
                <a-option :value="1">是</a-option>
              </a-select>
            </a-form-item>
          </a-col>
          <a-col :span="4">
            <a-form-item
              label="是否洗水"
              label-col-flex="80px"
              field="washingState"
              :rules="[{ required: dataForm.maintainType !== '转单', message: '是否洗水必填' }]"
              :validate-trigger="['change', 'blur']"
            >
              <a-select
                popup-container="html"
                allow-clear
                class="bacClass"
                v-model="dataForm.washingState"
              >
                <a-option :value="0">否</a-option>
                <a-option :value="1">是</a-option>
              </a-select>
            </a-form-item>
          </a-col>
          <a-col :span="4">
            <a-form-item
              label="洗后门幅"
              field="washingedLarghezza"
              label-col-flex="80px"
              :rules="[{ required: dataForm.washingState == '1', message: '洗后门幅必填' }]"
              :validate-trigger="['change', 'blur']"
            >
              <a-input
                allow-clear
                :style="{ width: '214px' }"
                class="bacClass"
                placeholder=""
                v-model="dataForm.washingedLarghezza"
              />
            </a-form-item>
          </a-col>
        </a-row>

        <a-row :gutter="16">
          <a-col :span="4">
            <a-form-item
              label="洗后克重"
              field="washingedWeight"
              label-col-flex="80px"
              :rules="[{ required: dataForm.washingState == '1', message: '洗后克重必填' }]"
              :validate-trigger="['change', 'blur']"
            >
              <a-input
                allow-clear
                :style="{ width: '214px' }"
                class="bacClass"
                placeholder=""
                v-model="dataForm.washingedWeight"
              />
            </a-form-item>
          </a-col>
          <a-col :span="4">
            <a-form-item
              label="总路数"
              label-col-flex="80px"
              field="sumNeedleCount"
              :rules="[{ required: dataForm.maintainType !== '转单', message: '总路数必填' }]"
              :validate-trigger="['change', 'blur']"
            >
              <a-input
                allow-clear
                :style="{ width: '214px' }"
                class="bacClass"
                placeholder=""
                v-model="dataForm.sumNeedleCount"
              />
            </a-form-item>
          </a-col>
          <a-col :span="4">
            <a-form-item
              label="排针三角"
              label-col-flex="80px"
              field="triangularState"
              :rules="[{ required: dataForm.maintainType !== '转单', message: '排针三角必填' }]"
              :validate-trigger="['change', 'blur']"
            >
              <a-select
                popup-container="html"
                allow-clear
                class="bacClass"
                v-model="dataForm.triangularState"
              >
                <a-option :value="0">否</a-option>
                <a-option :value="1">是</a-option>
              </a-select>
            </a-form-item>
          </a-col>
          <a-col :span="4">
            <a-form-item
              label="织针型号"
              label-col-flex="80px"
              field="knitModel"
              :rules="[{ required: dataForm.maintainType !== '转单', message: '织针型号必填' }]"
              :validate-trigger="['change', 'blur']"
            >
              <a-input
                allow-clear
                :style="{ width: '214px' }"
                class="bacClass"
                placeholder=""
                v-model="dataForm.knitModel"
              />
            </a-form-item>
          </a-col>
          <a-col :span="4">
            <a-form-item label="备注" label-col-flex="80px">
              <a-input
                allow-clear
                :style="{ width: '214px' }"
                class="bacClass"
                placeholder=""
                v-model="dataForm.remark"
              />
            </a-form-item>
          </a-col>
        </a-row>
        <a-divider />
      </a-form>
      <a-tabs :lazy-load="true">
        <a-tab-pane title="原料信息" key="1">
          <a-table
            style="padding-bottom: 20px"
            stripe
            :bordered="{ cell: true }"
            :columns="tableColumnsCf"
            size="mini"
            :data="dataForm.list"
            :pagination="false"
          >
          <template #yarnProportion="{ record }">
              <span>{{ record.yarnProportion == '' ? '' : (Number(record.yarnProportion)).toFixed(2) + '%'}}</span>
            </template>
            <template #yarnLength="{ record }">
              <span>{{ record.yarnLength == '' ? '' : (Number(record.yarnLength)).toFixed(2) }}</span>
            </template>
            <template #physicalLength="{ record }">
              <div style="width: 92%">
                <span style="color: red; font-size: 20px">*</span>
                <a-input class="bacClass" v-model="record.physicalLength" />
              </div>
            </template>
            <template #actualRatio="{ record }">
              <div style="width: 92%">
                <span v-if="dataForm.maintainType !== '转单'" style="color: red; font-size: 20px"
                  >*</span
                >
                <a-input-number
                  :precision="2"
                  class="bacClass"
                  v-model="record.actualRatio"
                  :min="0"
                />
              </div>
            </template>
          </a-table>
        </a-tab-pane>
        <a-tab-pane title="排针" key="2">
          <div style="width: 100%; overflow: auto">
            <div style="margin: 10px auto">
              <span>{{ dataForm.machineType == '单面机' ? '排针' : '上排' }}</span>
              <a-space>
                <input
                  disabled
                  size="mini"
                  v-for="(item, index) in zzpzdata"
                  :key="index"
                  style="width: 80px"
                  v-model="item.upBasin"
                />
              </a-space>
            </div>
            <div style="margin: 10px auto" v-if="dataForm.machineType !== '单面机'">
              <span>下排</span>
              <a-space>
                <input
                  disabled
                  size="mini"
                  v-for="(item, index) in zzpzdata"
                  :key="index"
                  style="width: 80px"
                  v-model="item.belowBasin"
                />
              </a-space>
            </div>
          </div>

          <div style="display: flex; align-items: center">
            <div style="width: 50%">
              <span>裁口排针</span>
              <a-input disabled v-model="ckpzobj.pinHeader"></a-input>
            </div>
            <div style="width: 50%">
              <span>纱线排列</span>
              <a-input disabled v-model="ckpzobj.arrangement"></a-input>
            </div>
          </div>
        </a-tab-pane>
        <a-tab-pane title="排三角" key="3">
          <div
            v-for="(item, index) in sjdata.sj as any"
            style="text-align: center; margin: 20px auto; width: 100%; overflow-x: auto"
          >
            <div
              style="
                text-align: center;
                color: #165dff;
                font-size: 16px;
                background-color: aliceblue;
                border-bottom: 0.5px solid #ccc;
              "
            >
              {{ item.type }}
            </div>

            <div class="thead" style="background-color: aliceblue">
              <div class="th" style="width: 50px">序号</div>
              <div class="th" style="width: 150px">用针</div>
              <div
                class="th"
                style="width: 40px"
                v-for="i2 in item.typeData[0].needleList"
                :key="i2.way"
              >
                {{ i2.way }}
              </div>
            </div>
            <div class="tbody" v-for="i1 in item.typeData">
              <div class="td" style="width: 50px">{{ i1.serialNumber }}</div>
              <div class="td" style="width: 150px">
                <a-input disabled v-model="i1.needleName"></a-input>
              </div>
              <div
                class="td"
                style="height: 34px; width: 40px; vertical-align: middle; border: 1px solid gray"
                v-for="i2 in i1.needleList"
              >
                <div style="width: 100%; height: 100%"
                  >{{ tags.filter((o) => o.id === i2.needle)[0]?.val }}
                </div>
              </div>
            </div>
            <div style="height: 20px"></div>
            <div style="height: 20px"></div>
            <div style="border: 1px solid #ccc"></div>
          </div>
          <div class="tbody" style="margin-top: 10px">
            <div
              style="
                text-align: center;
                color: #165dff;
                font-size: 16px;
                background-color: aliceblue;
                border-bottom: 0.5px solid #ccc;
              "
            >
              排纱
            </div>
            <div class="trow" style="background-color: aliceblue">
              <div
                style="
                  height: 30px;
                  display: inline-block;
                  width: 82px;
                  vertical-align: top;
                  box-sizing: border-box;
                "
              >
              </div>
              <div
                style="
                  height: 30px;
                  display: inline-block;
                  width: 82px;
                  vertical-align: top;
                  box-sizing: border-box;
                "
              >
              </div>
            </div>
            <div class="trow" v-for="(item, index) in psList">
              <div
                style="border: 1px solid #ccc; height: 30px; box-sizing: border-box"
                v-for="(item1, index1) in item"
              >
                <input
                  v-model="item1.val"
                  v-if="
                    !((index > 0 && (index1 == 0 || index1 == 1)) || (index == 0 && index1 === 2))
                  "
                  style="width: 80px; vertical-align: top; height: 100%; text-align: center"
                  :class="{ active: index1 == 0 || index1 == 1 }"
                />
                <div
                  v-if="(index > 0 && (index1 == 0 || index1 == 1)) || (index == 0 && index1 === 2)"
                  style="width: 80px; vertical-align: top; height: 100%; text-align: center"
                  :class="{ active: index1 == 0 || index1 == 1 }"
                  >{{ item1.val }}
                </div>
              </div>
            </div>
          </div>
        </a-tab-pane>
        <a-tab-pane title="调机标准参数" key="4">
          <a-row :gutter="16">
            <a-col :span="4">
              <div :style="{ fontFamily: 'Microsoft Yahei', fontSize: '16px' }"
                >布架宽度:&nbsp;&nbsp;{{ tjObj?.clothRackWidth }}
              </div>
            </a-col>
            <a-col :span="4">
              <div :style="{ fontFamily: 'Microsoft Yahei', fontSize: '16px' }">
                织针型号:&nbsp;&nbsp;{{ tjObj?.needleModel }}
              </div>
            </a-col>
            <a-col :span="4">
              <div :style="{ fontFamily: 'Microsoft Yahei', fontSize: '16px' }"
                >织针1段:&nbsp;&nbsp;{{ tjObj?.needleOnePerod == 1 ? '√' : '' }}
              </div>
            </a-col>
            <a-col :span="4">
              <div :style="{ fontFamily: 'Microsoft Yahei', fontSize: '16px' }"
                >织针2段:&nbsp;&nbsp;{{ tjObj?.needleTwoPerod == 1 ? '√' : '' }}
              </div>
            </a-col>
            <a-col :span="4">
              <div :style="{ fontFamily: 'Microsoft Yahei', fontSize: '16px' }"
                >织针3段:&nbsp;&nbsp;{{ tjObj?.needleThreePerod == 1 ? '√' : '' }}
              </div>
            </a-col>
            <a-col :span="4">
              <div :style="{ fontFamily: 'Microsoft Yahei', fontSize: '16px' }"
                >织针4段:&nbsp;&nbsp;{{ tjObj?.needleFourPerod == 1 ? '√' : '' }}
              </div>
            </a-col>
          </a-row>
          <a-divider />
          <a-row :gutter="16">
            <a-col :span="4">
              <div :style="{ fontFamily: 'Microsoft Yahei', fontSize: '16px' }"
                >织针需求等级:&nbsp;&nbsp;{{ tjObj?.needleGrade }}
              </div>
            </a-col>
            <a-col :span="4">
              <div :style="{ fontFamily: 'Microsoft Yahei', fontSize: '16px' }"
                >分食:&nbsp;&nbsp;{{ tjObj?.broken == 1 ? '√' : '' }}
              </div>
            </a-col>
            <a-col :span="4">
              <div :style="{ fontFamily: 'Microsoft Yahei', fontSize: '16px' }"
                >争食:&nbsp;&nbsp;{{ tjObj?.dodge == 1 ? '√' : '' }}
              </div>
            </a-col>
            <a-col :span="4">
              <div :style="{ fontFamily: 'Microsoft Yahei', fontSize: '16px' }"
                >不争不分:&nbsp;&nbsp;{{ tjObj?.allTrue == 1 ? '√' : '' }}
              </div>
            </a-col>
            <a-col :span="4">
              <div :style="{ fontFamily: 'Microsoft Yahei', fontSize: '16px' }"
                >布架张力A-D:&nbsp;&nbsp;{{ tjObj?.clothTensionAD }}
              </div>
            </a-col>
            <a-col :span="4">
              <div :style="{ fontFamily: 'Microsoft Yahei', fontSize: '16px' }"
                >布架张力1-16:&nbsp;&nbsp;{{ tjObj?.clothTensionOS }}
              </div>
            </a-col>
          </a-row>
          <a-divider />
          <a-row :gutter="16">
            <a-col :span="4">
              <div :style="{ fontFamily: 'Microsoft Yahei', fontSize: '16px' }">
                底座垫片:&nbsp;&nbsp;{{ tjObj?.baseGasket }}
              </div>
            </a-col>
            <a-col :span="4">
              <div :style="{ fontFamily: 'Microsoft Yahei', fontSize: '16px' }"
                >送纱盘-面盘:&nbsp;&nbsp;{{ tjObj?.sandTableSurfacePlate }}
              </div>
            </a-col>
            <a-col :span="4">
              <div :style="{ fontFamily: 'Microsoft Yahei', fontSize: '16px' }"
                >送纱盘-中盘:&nbsp;&nbsp;{{ tjObj?.sandTrayMiddlePlate }}
              </div>
            </a-col>
            <a-col :span="4">
              <div :style="{ fontFamily: 'Microsoft Yahei', fontSize: '16px' }"
                >送纱盘-底盘:&nbsp;&nbsp;{{ tjObj?.sandTrayMiddlePlate }}
              </div>
            </a-col>
            <a-col :span="4">
              <div :style="{ fontFamily: 'Microsoft Yahei', fontSize: '16px' }"
                >齿轮:&nbsp;&nbsp;{{ tjObj?.gear }}</div
              >
            </a-col>
            <a-col :span="4">
              <div :style="{ fontFamily: 'Microsoft Yahei', fontSize: '16px' }"
                >机速:&nbsp;&nbsp;{{ tjObj?.engineSpeed }}
              </div>
            </a-col>
          </a-row>
          <a-divider />
          <a-row :gutter="16">
            <a-col :span="4">
              <div :style="{ fontFamily: 'Microsoft Yahei', fontSize: '16px' }"
                >油速:&nbsp;&nbsp;{{ tjObj?.oilVelocity }}
              </div>
            </a-col>
            <a-col :span="4">
              <div :style="{ fontFamily: 'Microsoft Yahei', fontSize: '16px' }"
                >实开路数:&nbsp;&nbsp;{{ tjObj?.actualOpenWay }}
              </div>
            </a-col>
          </a-row>
        </a-tab-pane>
      </a-tabs>
    </a-modal>

    <a-modal v-model:visible="visible2" ok-text="打印" @ok="prints" :width="800">
      <template #title> 打印工艺单</template>
      <div id="gyFhPrint">
        <table class="isTable">
          <tr>
            <td colspan="6">织布工艺复核单</td>
          </tr>
          <tr>
            <td :style="{ width: '100px' }">织布单号:</td>
            <td :style="{ width: '150px' }">{{ dataForm.planOrderCode }}</td>
            <td :style="{ width: '100px' }">生产单号:</td>
            <td :style="{ width: '150px' }">{{ dataForm.weavCode }}</td>
            <td :style="{ width: '100px' }">坯布编号:</td>
            <td :style="{ width: '150px' }">{{ dataForm.greyCode }}</td>
          </tr>
          <tr>
            <td :style="{ width: '100px' }">客户名称:</td>
            <td :style="{ width: '150px' }">{{ dataForm.customName }}</td>
            <td :style="{ width: '100px' }">客户订单号:</td>
            <td :style="{ width: '150px' }">{{ dataForm.customOrderNo }}</td>
            <td :style="{ width: '100px' }">机台号:</td>
            <td :style="{ width: '150px' }">{{ dataForm.planMachineCode }}</td>
          </tr>
          <tr>
            <td :style="{ width: '100px' }">坯布名称:</td>
            <td colspan="3">{{ dataForm.greyName }}</td>
            <td :style="{ width: '100px' }">机型:</td>
            <td :style="{ width: '150px' }">{{ dataForm.machineType }}</td>
          </tr>
          <tr>
            <td :style="{ width: '100px' }">针寸数:</td>
            <td colspan="2">{{ dataForm.workDrum }}</td>
            <td :style="{ width: '150px' }"></td>
            <td :style="{ width: '100px' }">是否抽针:</td>
            <td :style="{ width: '150px' }">{{ dataForm.drawnNeedleState }}</td>
          </tr>
          <tr>
            <td :style="{ width: '100px' }">计划重量:</td>
            <td :style="{ width: '150px' }">{{ dataForm.orderWeight }}</td>
            <td :style="{ width: '100px' }">成品门幅:</td>
            <td :style="{ width: '150px' }">{{ dataForm.width }}</td>
            <td :style="{ width: '100px' }">成品克重:</td>
            <td :style="{ width: '150px' }">{{ dataForm.weight }}</td>
          </tr>
          <tr>
            <td colspan="6" :style="{ textAlign: 'left' }">复核参数</td>
          </tr>
          <tr>
            <td :style="{ width: '100px' }">机台转数:</td>
            <td :style="{ width: '150px' }">{{ dataForm.machineSpeed }}</td>
            <td :style="{ width: '100px' }">下机门幅:</td>
            <td :style="{ width: '150px' }">{{ dataForm.downLarghezza }}</td>
            <td :style="{ width: '100px' }">下机克重:</td>
            <td :style="{ width: '150px' }">{{ dataForm.downWeight }}</td>
          </tr>
          <tr>
            <td :style="{ width: '100px' }">是否洗水:</td>
            <td :style="{ width: '150px' }">{{ dataForm.washingState }}</td>
            <td :style="{ width: '100px' }">洗后门幅:</td>
            <td :style="{ width: '150px' }">{{ dataForm.washingedLarghezza }}</td>
            <td :style="{ width: '100px' }">洗后克重:</td>
            <td :style="{ width: '150px' }">{{ dataForm.washingedWeight }}</td>
          </tr>
          <tr>
            <td :style="{ width: '100px' }">实开路数:</td>
            <td :style="{ width: '150px' }">//</td>
            <td :style="{ width: '100px' }">是否染色:</td>
            <td :style="{ width: '150px' }">{{ dataForm.dyeState }}</td>
            <td :style="{ width: '100px' }">排针三角:</td>
            <td :style="{ width: '150px' }">{{ dataForm.triangularState }}</td>
          </tr>
          <tr>
            <td :style="{ width: '100px' }"></td>
            <td colspan="2"></td>
            <td :style="{ width: '150px' }"></td>
            <td :style="{ width: '100px' }">总路数:</td>
            <td :style="{ width: '150px' }">{{ dataForm.sumNeedleCount }}</td>
          </tr>
          <tr>
            <td colspan="7" :style="{ height: '300px' }">布板区</td>
          </tr>
        </table>
        <table class="isTable">
          <tr>
            <td :style="{ width: '83px' }">用纱代码</td>
            <td :style="{ width: '83px' }">原料名称</td>
            <td :style="{ width: '83px' }">纱牌</td>
            <td :style="{ width: '83px' }">批次</td>
            <td :style="{ width: '83px' }">色号/色称</td>
            <td :style="{ width: '83px' }">用纱比例</td>
            <td :style="{ width: '83px' }">实测比例</td>
            <td :style="{ width: '83px' }">要求纱长</td>
            <td :style="{ width: '83px' }">实测纱长</td>
          </tr>
          <tr v-for="item in dataForm.list">
            <td :style="{ width: '83px' }">{{ item.yarnSource }}</td>
            <td :style="{ width: '83px' }">{{ item.rawmaterialName }}</td>
            <td :style="{ width: '83px' }">{{ item.yarnCard }}</td>
            <td :style="{ width: '83px' }">{{ item.batch }}</td>
            <td :style="{ width: '83px' }">{{ item.colorCode + '/' + item.colorName }}</td>
            <td :style="{ width: '83px' }">{{ item.yarnProportion== '' ? '' : (Number(item.yarnProportion)).toFixed(2) + '%'  }}</td>
            <td :style="{ width: '83px' }">{{ item.actualRatio }}</td>
            <td :style="{ width: '83px' }">{{ item.yarnLength == '' ? '' : (Number(item.yarnLength)).toFixed(2) }}</td>
            <td :style="{ width: '83px' }">{{ item.physicalLength }}</td>
          </tr>
        </table>
      </div>
    </a-modal>
  </pageTabelLayout>
</template>

<script lang="ts">
import { pagingList } from '@/api/paging'
import { post } from '@/api/http'
import { useTable, useRowKey, useTableColumn, usePagination, useRowSelection } from '@/hooks/table'
import emitter from '@/hooks/useEventBus'
import { ref, reactive, onMounted, toRefs } from 'vue'
import Toolbar from '@/components/Toolbar.vue'
import { Form, Message, Modal } from '@arco-design/web-vue'
import { FormInstance } from '@arco-design/web-vue/es/form'
import { baseURL } from '../../../api/axios.config'
import axios from 'axios'
import filedownload from 'js-file-download'
import usePermission from '@/store/modules/permission'
import PageTabelLayout from '@/components/pageTabelLayout.vue'
import { AnyARecord } from 'dns'

import { localeText } from '@/api/aggridZw'
import { fontFamily } from 'html2canvas/dist/types/css/property-descriptors/font-family'
import printJS from 'print-js'
import { saveOrUpdateGridState as saveOrUpdateGridState01 } from '@/hooks/useGridState'

export default {
  name: 'ProcessReviews',
  setup() {
    const dataForm: any = reactive({
      list: [],
      customName: '',
      orderWeight: '',
      greyName: '',
      greyCode: '',
      drawnNeedleState: '',
      customOrderNo: '',
      weavCode: '',
      width: '',
      workDrum: '',
      planOrderCode: '',
      machineType: '',
      machineSpeed: '',
      downLarghezza: '',
      downWeight: '',
      dyeState: '',
      washingState: '',
      washingedLarghezza: '',
      washingedWeight: '',
      sumNeedleCount: '',
      triangularState: '',
      colorDescription: '',
      knitModel: '',
      machineCode: '',
      maintainType: '',
    })
    const total = ref(0)
    const page = ref(1)
    const size = ref(10)

    function PageSize(val: any) {
      pagination.page = val
      doRefresh()
    }

    function change1(val: any) {
      pagination.pageSize = val
      doRefresh()
    }

    const headerShow = ref<boolean>(true)

    //查询方法
    function doRefresh() {
      pageData.pageLoading = true
      updateGridState01()
      post({
        url: 'planSingle/craftRecheck/getPageByFirst',
        data: {
          page: pagination.page,
          size: pagination.pageSize,
          infoState: pageData.inspectionState == -1 ? null : pageData.inspectionState,
          adjustmentCode: pageData.adjustmentCode,
          empFirstVerifyTimeStart: pageData.dateStart,
          empFirstVerifyTimeEnd: pageData.dateEnd,
          weavCode: pageData.weavCode,
          planOrderCode: pageData.planOrderCode,
          machineCode: pageData.machineCode,
        },
      })
        .then(({ data, code, message }: any) => {
          if (code === 200) {
            table.handleSuccess(data.list)
            gridOption.value.setRowData(data.list)
            total.value = data.total
            // findUserToken()
          } else {
            Message.error({
              content: message,
              duration: 5000,
            })
          }
        })
        .catch(console.log)
        .finally(() => {
          pageData.pageLoading = false
        })
    }

    const { selectedRowKeys, onSelectionChange } = useRowSelection()
    const pagination = usePagination(doRefresh)
    const table = useTable()
    const rowKey = useRowKey('id')
    const tableColumns = useTableColumn([
      // {
      //     title: "序号",
      //     key: "id",
      //     dataIndex: "id",
      //     width: 150,
      // },
      {
        title: '公司',
        key: 'firm',
        dataIndex: 'firm',
        width: 150,
      },
      {
        title: '调机单号',
        key: 'adjustmentCode',
        dataIndex: 'adjustmentCode',
        width: 150,
      },
      {
        title: '调机类型',
        key: 'maintainType',
        dataIndex: 'maintainType',
        width: 150,
      },
      {
        title: '机台号',
        key: 'machineCode',
        dataIndex: 'machineCode',
        width: 150,
      },
      {
        title: '楼层',
        key: 'storey',
        dataIndex: 'storey',
        width: 150,
      },
      {
        title: '生产单号',
        key: 'weavCode',
        dataIndex: 'weavCode',
        width: 150,
      },
      {
        title: '织布单号',
        key: 'planOrderCode',
        dataIndex: 'planOrderCode',
        width: 150,
      },
      {
        title: '坯布编号',
        key: 'greyCode',
        dataIndex: 'greyCode',
        width: 150,
      },
      {
        title: '坯布名称',
        key: 'grayName',
        dataIndex: 'grayName',
        width: 150,
      },
      {
        title: '查布头时间',
        key: 'empFirstVerifyTime',
        dataIndex: 'empFirstVerifyTime',
        width: 150,
      },
      {
        title: '调机布重量',
        key: 'adjustmentWeight',
        dataIndex: 'adjustmentWeight',
        width: 150,
      },

      // {
      //   title: '查布头次数',
      //   key: 'firstCount',
      //   dataIndex: 'firstCount',
      //   width: 150,
      // },
      // {
      //   title: '完结状态',
      //   key: 'adjustmentState',
      //   dataIndex: 'adjustmentState',
      //   slotName: 'adjustmentState',
      //   width: 150,
      //   fixed: 'right'
      // },
      {
        title: '复核结果',
        key: 'infoState',
        dataIndex: 'infoState',
        slotName: 'infoState',
        width: 200,
        fixed: 'right',
      },
      {
        title: '操作',
        key: 'act',
        slotName: 'act',
        width: 150,
        fixed: 'right',
      },
    ])
    let tc: any[] = tableColumns.map((o) => {
      let obj = {
        headerName: o.title,
        field: o.key,
        pinned: o['fixed'],
        tooltipField: o.key,
      }
      //
      if (o.slotName === 'act') {
        obj['resizable'] = false
        obj['filter'] = false
        obj['sortable'] = false
        obj['lockPosition'] = 'right'
        obj['width'] = 122
        obj['cellRenderer'] = {
          template: `
            <a-space>
              <el-button :disabled="state == 1" style="color:#165dff;" link @click="b">处理</el-button>
              <el-button style="color:#165dff;" link @click="a">详情</el-button>
            </a-space>
          `,
          setup(props: any) {
            const a = () => {
              handleClick(props.params.data)
            }
            const b = () => {
              handleClick1(props.params.data)
            }
            props.params.data.inspectionState
            // let f = permissionStore.hasPermisson('sjjlcx.xg')
            return {
              a,
              // f,
              b,
              state: props.params.data.infoState,
            }
          },
        }
      }
      if (o.slotName === 'infoState') {
        obj['resizable'] = false
        obj['filter'] = false
        obj['sortable'] = false
        obj['width'] = 110
        obj['cellRenderer'] = {
          template: `
            <a-space>
              <el-tag class="ml-2" v-if="a == 1" type="success">{{ val }}</el-tag>
              <el-tag class="ml-2" v-if="a == 0" type="warning">{{ val }}</el-tag>
              <el-tag class="ml-2" v-if="a == 2" type="warning">{{ val }}</el-tag>
            </a-space>
          `,
          setup(props: any) {
            let val = ref()
            val.value =
              props.params.data.infoState == 0
                ? '不OK'
                : props.params.data.infoState == 1
                ? 'OK'
                : '未检验'
            return {
              val,
              a: props.params.data.infoState,
            }
          },
        }
      }
      if (o.slotName === 'adjustmentState') {
        obj['resizable'] = false
        obj['filter'] = false
        obj['sortable'] = false
        obj['width'] = 110
        obj['cellRenderer'] = {
          template: `
            <a-space>
              <el-tag class="ml-2" v-if="a == 3" type="success">{{ val }}</el-tag>
              <el-tag class="ml-2" v-if="a ==2" type="warning">{{ val }}</el-tag>
            </a-space>
          `,
          setup(props: any) {
            let val = ref()
            val.value = props.params.data.adjustmentState == 3 ? '已完结' : '未完结'
            return {
              val,
              a: props.params.data.adjustmentState,
            }
          },
        }
      }

      return obj
    })

    let a = [
      {
        showRowGroup: 'hide_def',
        headerName: '',
        checkboxSelection: true,
        headerCheckboxSelection: true,
        pinned: 'left',
        width: 50,
        resizable: false,
        filter: false,
        sortable: false,
        minWidth: 50,
        maxWidth: 50,
        lockPosition: 'left',
      },
    ]
    tc = a.concat(tc)

    const pageData = reactive<{
      dateEnd: any
      dateStart: any
      showAdd: boolean
      sideTitle: string
      dropDownData: any
      // dropDownData1: any,
      nameList: []
      nameList2: []
      pageLoading: boolean
      typeList: []
      dropDownData1: any
      rHeight: any
      btnList: any[]
      isEdit: boolean
      TypeNameList: any[]
      file: string
      isShow: boolean
      isShow2: boolean
      adjustmentCode: any
      weavCode: any
      inspectionState: any
      defectNameList: any[]
      adjustmentState: any
      planOrderCode: any
      machineCode: any
    }>({
      dateEnd: '',
      dateStart: '',
      nameList: [],
      nameList2: [],
      showAdd: false,
      sideTitle: '新增程序号',
      dropDownData: '',
      pageLoading: false,
      typeList: [],
      dropDownData1: '',
      rHeight: 0,
      btnList: [],
      isEdit: false,
      TypeNameList: [],
      file: '',
      isShow: false,
      isShow2: false,
      adjustmentCode: '',
      weavCode: '',
      inspectionState: 0,
      defectNameList: [],
      adjustmentState: 2,
      planOrderCode: '',
      machineCode: '',
    })

    interface gcType {
      id: any
      company: any
    }

    //调机类型下拉框得到焦点
    const focusSel = () => {
      selCxAll({ adjustmentTypeName: '' })
    }

    //下拉数据
    const options = ref<any>(pageData.nameList)
    const loading = ref(false)
    const handleSearch = (value: any) => {
      if (value) {
        const ob = { adjustmentTypeName: value }
        loading.value = true
        selCxAll(ob)
        options.value = pageData.nameList
        loading.value = false
      } else {
        options.value = []
      }
    }

    //下拉框查询
    function selCxAll(val: any) {
      post({
        url: '/qms/AdjustmentType/getFieldValue',
        data: val,
      }).then(({ data, code }: any) => {
        if (code === 200) {
          pageData.nameList = data
        } else {
          Message.error({
            content: '查询失败！',
            duration: 5000,
          })
        }
      })
    }

    onMounted(() => {
      doRefresh()
      // 切换tap到本页面执行的方法
      emitter.on('FirstInspectionRecordListDemo', () => {
        doRefresh()
      })
      pageData.rHeight = document.getElementsByClassName('arco-tabs-content')[0]?.clientHeight
      //弹出层的高
      if (pageData.rHeight !== undefined) {
        pageData.rHeight = pageData.rHeight - 100
      }
      window.addEventListener('resize', () => {
        pageData.rHeight = document.getElementsByClassName('arco-tabs-content')[0]?.clientHeight
        //弹出层的高
        if (pageData.rHeight !== undefined) {
          pageData.rHeight = pageData.rHeight - 100
        }
      })
    })

    let cxbl = {}
    //查询
    const selectHandler = () => {
      pagination.page = 1
      cxbl = pageData.dropDownData
      doRefresh()
    }
    const queryData = reactive({
      programType: '',
    })

    // 表格准备事件
    const gridOption = ref()
    const colState = ref()
    const gridReady = (params: any) => {
      gridOption.value = params.api
      colState.value = params.columnApi
    }

    const formRef = ref<FormInstance>()

    const handleChange = (_data: any) => {
      table.handleSuccess(_data)
    }
    const defaultColDef = {
      sortable: true,
      resizable: true,
      filter: true,
      // flex: 1
    }

    const localeText1: any = ref(localeText)
    const huiche = () => {
      doRefresh()
    }
    const pagingList1: any = ref(pagingList)

    //设置权限
    // ['查询', '新增', '删除', '导出', '导入']
    const permissionStore = usePermission()
    pageData.btnList.push('查询', '打印')
    // if (permissionStore.hasPermisson('sjjlcx.cx')) {
    //   pageData.btnList.push('查询', '打印')
    // }
    // if (permissionStore.hasPermisson('sjjlcx.sc')) {
    //   pageData.btnList.push('删除')
    // }
    //详情
    const visible = ref(false)

    const tjObj: any = ref()

    const handleClick = (record: any) => {
      post({
        url: 'planSingle/craftRecheck/getDetial',
        data: {
          id: record.id,
          planOrderCode: record.planOrderCode,
          weavCode: record.weavCode,
          machineCode: record.machineCode,
        },
      }).then(({ data, code, message }: any) => {
        if (code === 200) {
          for (let key in data.craftInfo) {
            dataForm[key] = data.craftInfo[key]
          }
          if (data.craftInfo.drawnNeedleState == 0) {
            dataForm.drawnNeedleState = '抽针'
          } else if (data.craftInfo.drawnNeedleState == 1) {
            dataForm.drawnNeedleState = '圆筒'
          } else {
            dataForm.drawnNeedleState = ''
          }
          if (dataForm.type == 0) {
            dataForm.type = '不开幅'
          } else if (dataForm.type == 1) {
            dataForm.type = '开幅'
          } else {
            dataForm.type = ''
          }
          dataForm.weavCode = data.craftInfo.weavCode
          dataForm.machineCode = record.machineCode
          dataForm.maintainType = record.maintainType
          dataForm.list = data.rawmaterialInfo.sort(function (a: any, b: any) {
            var sourceA = a.yarnSource ? String(a.yarnSource).toUpperCase() : ''
            var sourceB = b.yarnSource ? String(b.yarnSource).toUpperCase() : ''
            if (sourceA < sourceB) {
              return -1
            }
            if (sourceA > sourceB) {
              return 1
            }
            return 0
          })
          post({
            url: 'planSingle/craftRecheck/getMachineStandard',
            data: {
              greyCloth: dataForm.greyCode,
            },
          }).then((z: any) => {
            if (z.code == 200) {
              tjObj.value = z.data
            }
          })
          post({
            url: 'product/pdGreyInformation/selectpdGreyInformation',
            data: {
              greyCode: dataForm.greyCode,
            },
          }).then(({ code, data, message }) => {
            if (code == 200) {
              let ids: any
              if (data.length > 0) {
                ids = data[0].id
                post({
                  url: 'product/pdGreyInformation/select',
                  data: {
                    id: ids,
                  },
                }).then(({ data, code, message }) => {
                  if (code == 200) {
                    // 组织排针 数据
                    zzpzdata.value =
                      data.organizationPinSons.length == 0
                        ? [
                            {
                              upBasin: '',
                              belowBasin: '',
                              id: '',
                              pdOrganizationPinId: '',
                            },
                          ]
                        : data.organizationPinSons
                    // 裁口排针
                    if (
                      data.cuttingMouthNeedleGrey != null &&
                      data.cuttingMouthNeedleGrey.length > 0
                    ) {
                      let cuttingMouthNeedleGrey = data.cuttingMouthNeedleGrey[0]
                      ckpzobj.id = cuttingMouthNeedleGrey.id
                      ckpzobj.pinHeader = cuttingMouthNeedleGrey.pinHeader
                      ckpzobj.arrangement = cuttingMouthNeedleGrey.arrangement
                    }
                    // 排三角arrangementTriangleGreys
                    sjdata.sj = data.arrangementTriangleGreys.info
                    // sjdata.sjid=data.arrangementTriangleGreys.greyId
                    // psjpb.value=data.arrangementTriangleGreys.greyId 现有坯布
                    sjdata.atCode = data.arrangementTriangleGreys.atCode
                    sjdata.atName = data.arrangementTriangleGreys.atName
                    sjdata.remark = data.arrangementTriangleGreys.remark
                    psList.value = data.atOther
                  } else {
                    Message.error(message)
                  }
                })
              }
            } else {
              Message.error(message)
            }
          })
          visible.value = true
        } else {
          Message.error({
            content: message,
            duration: 5000,
          })
        }
      })
    }
    const handleOk = () => {
      visible.value = false
    }
    const handleCancel = () => {
      visible.value = false
    }
    //登记
    const visible1 = ref(false)

    let records: any

    const handleClick1 = (record: any) => {
      for (let key in dataForm) {
        dataForm[key] = ''
      }
      records = record
      console.log(record)
      post({
        url: 'planSingle/craftRecheck/getDetial',
        data: {
          id: record.id,
          planOrderCode: record.planOrderCode,
          weavCode: record.weavCode,
          machineCode: record.machineCode,
        },
      }).then(({ data, code, message }: any) => {
        if (code === 200) {
          for (let key in data.craftInfo) {
            dataForm[key] = data.craftInfo[key]
          }
          if (data.craftInfo.drawnNeedleState == 0) {
            dataForm.drawnNeedleState = '抽针'
          } else if (data.craftInfo.drawnNeedleState == 1) {
            dataForm.drawnNeedleState = '圆筒'
          } else {
            dataForm.drawnNeedleState = ''
          }
          if (dataForm.type == 0) {
            dataForm.type = '不开幅'
          } else if (dataForm.type == 1) {
            dataForm.type = '开福'
          } else {
            dataForm.type = ''
          }
          dataForm.weavCode = data.craftInfo.weavCode
          dataForm.machineCode = record.machineCode
          dataForm.maintainType = record.maintainType
          dataForm.list = data.rawmaterialInfo.sort(function (a: any, b: any) {
            var sourceA = a.yarnSource ? String(a.yarnSource).toUpperCase() : ''
            var sourceB = b.yarnSource ? String(b.yarnSource).toUpperCase() : ''

            if (sourceA < sourceB) {
              return -1
            }
            if (sourceA > sourceB) {
              return 1
            }
            return 0
          })
          post({
            url: 'planSingle/craftRecheck/getMachineStandard',
            data: {
              greyCloth: dataForm.greyCode,
            },
          }).then((z: any) => {
            if (z.code == 200) {
              tjObj.value = z.data
            }
          })
          post({
            url: 'product/pdGreyInformation/selectpdGreyInformation',
            data: {
              greyCode: dataForm.greyCode,
            },
          }).then(({ code, data, message }) => {
            if (code == 200) {
              let ids: any
              ids = data[0].id
              post({
                url: 'product/pdGreyInformation/select',
                data: {
                  id: ids,
                },
              }).then(({ data, code, message }) => {
                if (code == 200) {
                  // 组织排针 数据
                  zzpzdata.value =
                    data.organizationPinSons.length == 0
                      ? [
                          {
                            upBasin: '',
                            belowBasin: '',
                            id: '',
                            pdOrganizationPinId: '',
                          },
                        ]
                      : data.organizationPinSons
                  // 裁口排针
                  if (
                    data.cuttingMouthNeedleGrey != null &&
                    data.cuttingMouthNeedleGrey.length > 0
                  ) {
                    let cuttingMouthNeedleGrey = data.cuttingMouthNeedleGrey[0]
                    ckpzobj.id = cuttingMouthNeedleGrey.id
                    ckpzobj.pinHeader = cuttingMouthNeedleGrey.pinHeader
                    ckpzobj.arrangement = cuttingMouthNeedleGrey.arrangement
                  }
                  // 排三角arrangementTriangleGreys
                  sjdata.sj = data.arrangementTriangleGreys.info
                  // sjdata.sjid=data.arrangementTriangleGreys.greyId
                  // psjpb.value=data.arrangementTriangleGreys.greyId 现有坯布
                  sjdata.atCode = data.arrangementTriangleGreys.atCode
                  sjdata.atName = data.arrangementTriangleGreys.atName
                  sjdata.remark = data.arrangementTriangleGreys.remark
                  psList.value = data.atOther
                } else {
                  Message.error(message)
                }
              })
            } else {
              Message.error(message)
            }
          })
          visible1.value = true
        } else {
          Message.error({
            content: message,
            duration: 5000,
          })
        }
      })
    }
    const handleCancel1 = () => {
      if (dataForm.maintainType !== '转单') {
        let sum = 0
        dataForm.list.forEach((item: any) => {
          sum += item.actualRatio
        })
        if (sum !== 100) {
          Message.warning('实测纱比之和一定等于100')
          return
        }
      }
      post({
        url: 'planSingle/craftRecheck/addRecording',
        data: {
          infoState: 0,
          mainInfo: {
            id: records.id,
            adjustmentId: records.adjustmentId,
            adjustmentCode: records.adjustmentCode,
            weavCode: records.planOrderCode,
            machineSpeed: dataForm.machineSpeed,
            downLarghezza: dataForm.downLarghezza,
            downWeight: dataForm.downWeight,
            dyeState: dataForm.dyeState,
            washingState: dataForm.washingState,
            washingedLarghezza: dataForm.washingedLarghezza,
            washingedWeight: dataForm.washingedWeight,
            sumNeedleCount: dataForm.sumNeedleCount,
            triangularState: dataForm.triangularState,
            knitModel: dataForm.knitModel,
            remark: dataForm.remark,
          },
          sonInfo: dataForm.list,
        },
      }).then(({ code, data, message }) => {
        if (code == 200) {
          visible1.value = false
          doRefresh()
          formRef1.value?.resetFields()
          Message.success(message)
        } else {
          Message.warning(message)
        }
      })
    }
    const formRef1 = ref()
    const okClick = async () => {
      let data1 = dataForm.list.find((o: any) => !o.physicalLength || o.physicalLength == 0)
      let data2 = dataForm.list.find((o: any) => !o.actualRatio || o.actualRatio == 0)
      if (dataForm.maintainType === '转单' && data1) {
        Message.warning('实测纱长必填')
        return
      }
      if (dataForm.maintainType !== '转单' && data1) {
        Message.warning('实测纱长必填')
        return
      }
      if (dataForm.maintainType !== '转单' && data2) {
        Message.warning('实测纱比必填')
        return
      }
      if (dataForm.maintainType !== '转单') {
        let sum = 0
        dataForm.list.forEach((item: any) => {
          sum += item.actualRatio
        })
        if (sum !== 100) {
          Message.warning('实测纱比之和一定等于100')
          return
        }
      }
      formRef1.value?.validate().then((err: any) => {
        if (!err) {
          pageData.pageLoading = true
          post({
            url: 'planSingle/craftRecheck/addRecording',
            data: {
              infoState: 1,
              mainInfo: {
                id: records.id,
                adjustmentId: records.adjustmentId,
                adjustmentCode: records.adjustmentCode,
                weavCode: records.planOrderCode,
                machineSpeed: dataForm.machineSpeed,
                downLarghezza: dataForm.downLarghezza,
                downWeight: dataForm.downWeight,
                dyeState: dataForm.dyeState,
                washingState: dataForm.washingState,
                washingedLarghezza: dataForm.washingedLarghezza,
                washingedWeight: dataForm.washingedWeight,
                sumNeedleCount: dataForm.sumNeedleCount,
                triangularState: dataForm.triangularState,
                knitModel: dataForm.knitModel,
                remark: dataForm.remark,
              },
              sonInfo: dataForm.list,
            },
          })
            .then(({ code, data, message }) => {
              if (code == 200) {
                visible1.value = false
                doRefresh()
                formRef1.value?.resetFields()
                Message.success(message)
              } else {
                Message.warning(message)
              }
            })
            .catch(console.log)
            .finally(() => {
              pageData.pageLoading = false
            })
        }
      })
    }
    const tableColumnsCf = useTableColumn([
      {
        title: '用纱代码',
        key: 'yarnSource',
        dataIndex: 'yarnSource',
        width: 150,
      },
      {
        title: '原料编号',
        key: 'rawmaterialCode',
        dataIndex: 'rawmaterialCode',
        width: 150,
      },
      {
        title: '原料名称',
        key: 'rawmaterialName',
        dataIndex: 'rawmaterialName',
        width: 150,
      },
      {
        title: '纱牌',
        key: 'yarnCard',
        dataIndex: 'yarnCard',
        width: 150,
      },
      {
        title: '纱批',
        key: 'batch',
        dataIndex: 'batch',
        width: 150,
        slotName: 'batch',
      },
      {
        title: '色号',
        key: 'colorCode',
        dataIndex: 'colorCode',
        width: 150,
        slotName: 'colorCode',
      },
      {
        title: '色称',
        key: 'colorName',
        dataIndex: 'colorName',
        width: 150,
        slotName: 'colorName',
      },
      {
        title: '等级',
        key: 'level',
        dataIndex: 'level',
        width: 150,
        slotName: 'level',
      },
      {
        title: '用纱比例',
        key: 'yarnProportion',
        dataIndex: 'yarnProportion',
        width: 150,
        slotName: 'yarnProportion',
      },
      {
        title: '实测纱比',
        key: 'actualRatio',
        dataIndex: 'actualRatio',
        width: 150,
        slotName: 'actualRatio',
      },
      {
        title: '要求纱长',
        key: 'yarnLength',
        dataIndex: 'yarnLength',
        slotName: 'yarnLength',
        width: 150,
      },
      {
        title: '实测纱长',
        key: 'physicalLength',
        dataIndex: 'physicalLength',
        width: 150,
        slotName: 'physicalLength',
      },
    ])
    //查询当前账号
    // function findUserToken() {
    //     post({
    //         url: 'admin/acl/user/findUserToken',
    //         data: {}
    //     }).then(({ data, code, message }: any) => {
    //         if (code === 200) {
    //             if (Object.keys(data.data['empMap'])?.length == 0) {
    //                 Message.error({
    //                     duration: 5000,
    //                     content: '此账号未关联员工!'
    //                 })
    //             } else {
    //                 dataForm['firstverifyUser'] = data.data['empMap']['name']
    //             }
    //         } else {
    //             Message.error({
    //                 content: message,
    //                 duration: 5000,
    //             })
    //         }
    //     })
    // }
    //查询疵点
    function getDefectName() {
      post({
        url: 'qms/defectType/select',
        data: {
          deleteState: 0,
        },
      }).then(({ data, code, message }: any) => {
        if (code === 200) {
          console.log(data)

          pageData.defectNameList = data
        } else {
          Message.error({
            content: message,
            duration: 5000,
          })
        }
      })
    }

    const dyBoufeis = () => {
      if (
        gridOption.value.getSelectedRows().length == 0 ||
        gridOption.value.getSelectedRows().length > 1
      ) {
        Message.warning('勾选数据有误')
        return false
      }
      post({
        url: 'planSingle/craftRecheck/getDetial',
        data: {
          id: gridOption.value.getSelectedRows()[0].id,
          planOrderCode: gridOption.value.getSelectedRows()[0].planOrderCode,
          weavCode: gridOption.value.getSelectedRows()[0].weavCode,
          machineCode: gridOption.value.getSelectedRows()[0].machineCode,
        },
      }).then(({ data, code, message }: any) => {
        if (code === 200) {
          for (let key in data.craftInfo) {
            dataForm[key] = data.craftInfo[key]
          }
          if (data.craftInfo.drawnNeedleState == 0) {
            dataForm.drawnNeedleState = '抽针'
          } else if (data.craftInfo.drawnNeedleState == 1) {
            dataForm.drawnNeedleState = '圆筒'
          } else {
            dataForm.drawnNeedleState = ''
          }
          if (dataForm.type == 0) {
            dataForm.type = '不开幅'
          } else if (dataForm.type == 1) {
            dataForm.type = '开福'
          } else {
            dataForm.type = ''
          }
          dataForm.weavCode = data.craftInfo.weavCode
          dataForm.list = data.rawmaterialInfo.sort(function (a: any, b: any) {
            var sourceA = a.yarnSource ? String(a.yarnSource).toUpperCase() : ''
            var sourceB = b.yarnSource ? String(b.yarnSource).toUpperCase() : ''

            if (sourceA < sourceB) {
              return -1
            }
            if (sourceA > sourceB) {
              return 1
            }
            return 0
          })
          visible2.value = true
        } else {
          Message.error({
            content: message,
            duration: 5000,
          })
        }
      })
    }
    const prints = () => {
      printJS({
        printable: 'gyFhPrint',
        type: 'html',
        targetStyles: ['*'],
      })
    }
    const visible2 = ref(false)

    const zzpzdata = ref<any>()
    const sjdata: any = reactive<{ sj: any[] }>({ sj: [] })
    let psList = ref<any[]>([])
    const ckpzobj = reactive({
      id: 0,
      pinHeader: '',
      arrangement: '',
    })
    const tags = [
      { id: '1', val: '̶' },
      { id: '2', val: 'Ո' },
      { id: '3', val: 'Ս' },
      { id: '4', val: 'Ʌ' },
      {
        id: '5',
        val: 'V',
      },
    ]

    //打印预览PDF
    const printPdf = () => {
      if (gridOption.value.getSelectedRows().length === 0) {
        Message.warning('请勾选数据')
        return false
      }
      let list = []
      for (let i = 0; i < gridOption.value.getSelectedRows().length; i++) {
        var ob = {}
        ;(ob['id'] = gridOption.value.getSelectedRows()[i].id),
          (ob['planOrderCode'] = gridOption.value.getSelectedRows()[i].planOrderCode),
          (ob['weavCode'] = gridOption.value.getSelectedRows()[i].weavCode),
          (ob['machineCode'] = gridOption.value.getSelectedRows()[i].machineCode)
        list.push(ob)
      }
      console.log(list)
      post({
        url: 'planSingle/craftRecheck/printDetial',
        data: list,
        responseType: 'blob',
      }).then((res) => {
        let reader = new FileReader()
        reader.readAsDataURL(res)
        reader.onload = function () {
          let pdfBase64 = reader.result.replace('data:application/pdf;base64,', '')
          printJS({ printable: pdfBase64, type: 'pdf', base64: true })
        }
      })
    }
    const { saveGridState: saveGridState01, updateGridState: updateGridState01 } =
      saveOrUpdateGridState01('ProcessReviews-1', gridOption, colState, tc)
    const onColumnMoved = () => {
      saveGridState01()
    }
    const onColumnResized = () => {
      saveGridState01()
    }
    const onColumnVisible = () => {
      saveGridState01()
    }
    const isxqObjay = async (greyCloth: any) => {
      const { data } = await post({
        url: 'planSingle/machineStandard/getOntByGrey',
        data: {
          greyCloth,
        },
      })
      for (let key in data) {
        tjObj[key] = data[key]
      }
    }
    watch(
      () => visible.value,
      (l, o) => {
        if (l) {
          nextTick(() => {
            if (dataForm.greyCode) {
              isxqObjay(dataForm.greyCode)
            }
          })
        }
      }
    )
    watch(
      () => visible1.value,
      (l, o) => {
        if (l) {
          nextTick(() => {
            if (dataForm.greyCode) {
              isxqObjay(dataForm.greyCode)
            }
          })
        }
      }
    )
    const handleClose = () => {
      visible1.value = false
    }
    return {
      handleClose,
      saveOrUpdateGridState01,
      saveGridState01,
      updateGridState01,
      onColumnMoved,
      onColumnResized,
      onColumnVisible,
      colState,
      formRef1,
      printPdf,
      zzpzdata,
      sjdata,
      psList,
      ckpzobj,
      tags,
      visible2,
      prints,
      dyBoufeis,
      tjObj,
      okClick,
      handleCancel1,
      handleClick1,
      visible1,
      tableColumnsCf,
      visible,
      handleClick,
      handleOk,
      handleCancel,
      pagingList1,
      huiche,
      localeText1,
      formRef,
      dataForm,
      selectedRowKeys,
      pagination,
      tableColumns,
      table,
      rowKey,
      pageData,
      queryData,
      selectHandler,
      options,
      loading,
      handleSearch,
      focusSel,
      headerShow,
      handleChange,
      PageSize,
      change1,
      defaultColDef,
      tc,
      gridOption,
      gridReady,
      total,
      page,
      size,
    }
  },
  components: { Toolbar, PageTabelLayout },
}
</script>
<style scoped lang="less">
:deep(.ag-cell) {
  border-right: 1px solid #dde2eb;
}

:deep(.ag-header-cell) {
  border-right: 1px solid #dde2eb;
}

:deep(.ag-cell-value) {
  user-select: initial;
  -moz-user-select: text;
  -ms-user-select: text;
  -webkit-user-select: text;
}

:deep(.arco-table-td-content) {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

:deep(.ag-cell) {
  border-right: 1px solid #dde2eb;
}

:deep(.ag-header-cell) {
  border-right: 1px solid #dde2eb;
}

.isTable {
  width: 100%;
  margin: 0 auto;
  border: 1.2px solid #ccc;
  text-align: center;
  border-collapse: collapse;

  tr {
    height: 10px;
  }

  td {
    border: 1.2px solid #ccc;
  }
}

.thead {
  white-space: nowrap;
  justify-content: center;

  .th {
    box-sizing: border-box;
    text-align: center;
    display: inline-block;
  }

  width: 100%;
  text-align: left;
}

.tbody {
  white-space: nowrap;
  justify-content: center;

  .td {
    text-align: center;
    box-sizing: border-box;
    display: inline-block;
  }

  text-align: left;
}

.trow > div {
  display: inline-block;
  text-align: center;
}

.active {
  width: 80px !important;
}
</style>
